#include "stdafx.h"
#include "income.h"
#include "julianDate.h"

CIncome::CIncome(std::string name, long double principal, double rate)
:  CMoney(name, principal, rate)
{
    m_interest.clear();
}

CIncome::~CIncome()
{
    
}

void CIncome::refresh()
{
    
}

void CIncome::print()
{
    refresh();
    std::cout<<"Income Name: " << m_name << std::endl
        << "Rate: " << m_rate << std::endl
        << "Start Date: " << asctime(localtime(&m_startDate)) << std::endl
        << "Last Activity Date: " << asctime(localtime(&m_endDate)) << std::endl
        << "Total Income Remaining: " << getTotal() << std::endl;
}

double CIncome::makeDeposit(double deposit)
{
    time(&m_endDate); 
    m_values.push_back(deposit);
    return 0.0;
}

double CIncome::makeWithdraw(double withdraw)
{
    if(withdraw > 0.0)
        m_values.push_back(-withdraw);
    else
        m_values.push_back(withdraw);   
    return 0.0;
}